package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.entity.GlPeople;
import com.ruoyi.system.mapper.GlPeopleMapper;
import com.ruoyi.system.service.GlPeopleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author ruochen
* @description 针对表【gl_people(隔离人员)】的数据库操作Service实现
* @createDate 2023-11-12 11:42:01
*/
@Service
public class GlPeopleServiceImpl extends ServiceImpl<GlPeopleMapper, GlPeople>
    implements GlPeopleService{

    @Autowired
    private GlPeopleMapper glPeopleMapper;

    @Override
    public List<GlPeople> getGlPeopleInfoList(String userName, String phoneNumber, String idNumber, String address, String startTime, String endTime) {

        List<GlPeople> glPeopleList = glPeopleMapper.getGlPeopleInfoList( userName, phoneNumber, idNumber, address, startTime, endTime);

        return glPeopleList;
    }

    @Override
    public List<GlPeople> getGlPeopleNameAndId() {
        LambdaQueryWrapper<GlPeople> glPeopleLambdaQueryWrapper = new LambdaQueryWrapper<>();
        glPeopleLambdaQueryWrapper.select(GlPeople::getUserId,GlPeople::getUserName);
        List<GlPeople> glPeopleList = glPeopleMapper.selectList(glPeopleLambdaQueryWrapper);
        if (glPeopleList.size() == 0){
          throw new RuntimeException("查询隔离人员姓名和id为空");
        }
        return glPeopleList;
    }


}




